<template>
  <div class="withdrawal-page">
    <div class="withdrawal-card">

      <div style="display: flex; justify-content: space-between; align-items: center;">
        <span>提现到账</span>
        <span style="color: #666666;">微信零钱 </span>
      </div>

      <div style="margin-top: 36rpx;">
        提现金额
      </div>

      <div style="margin-top: 36rpx; display: flex;   align-items: center;">
        <span style="font-size: 72rpx; font-weight: 600; margin-right: 20rpx;">¥ </span>
        <input type="number" v-model="amount"   placeholder="请输入提现金额" />
      </div>

      <div style="margin-top: 36rpx; display: flex;justify-content: space-between;">
        <span>可提现金额¥{{ info.withdrawable_money }}（10积分=1元） </span>
        <span @click="allTx" style="color: #FF504D ;">全部提现 </span>
      </div>
    </div>

    <div style="margin-top: 40rpx;">
      <button style="background-color: #63A7F6; color: white; font-size: 32rpx; width: 100%; border-radius: 28rpx;"
        hover-class="button-hover" @click="tixianFn" block>
        确认提现
      </button>
    </div>
  </div>
</template>

<script>
import { withdraw, getPointInfo } from '@/api/index'
export default {
  name: 'Withdrawal',
  data() {
    return {
      value: '',
      amount: "",
      info: {}
    };
  },
  async onLoad() {
    const _res = await getPointInfo();

    console.log('_res?.data?.info=>', _res?.data?.info);

    this.info = _res?.data?.info
  },

  methods: {
    allTx() {
      this.amount = this.info.withdrawable_money
    },
    handleChange(event) {
      console.log(event);
    },
    async tixianFn() {
      try {
        await withdraw({
          "form": {
            "money": this.amount
          }
        })
      } catch (error) {

      }
    }
  },

};
</script>

<style lang="scss" scoped>
page {
  background: #F2F2F2;
  color: #999999;
  font-size: 28rpx;
}

.withdrawal-page {
  padding: 30rpx;
  border-radius: 36rpx;
}


.withdrawal-card {
  background-color: white;
  padding: 30rpx;
  border-radius: 36rpx;
}

.mt-30rpx {
  margin-top: 30rpx;
}
</style>
